<?php
include '../common.php';
class NewestMovie {
	// 影片id
	private $movieId;
	// 影片对应的海报地址
	private $movieImg;
	// 影片名称
	private $movieName;
	// 影片简介
	private $movieComment;
	// 影片对应类型 （动作 |竞技）
	private $movieType;
	// 影片有多少人观看
	private $movieWatched;
	/**
	 * *** 预留字段 ******
	 */
	// 影片分数 （1.0 ~ 10.0）
	private $movieScroe;
	// 影片price
	private $moviePrice;
	public $conn;
	
	// setter
	function setMovieId($id) {
		$this->movieId = id;
	}
	function setMovieImg($imgURL) {
		$this->movieImg = imgURL;
	}
	function setMovieName($name) {
		$this->movieName = name;
	}
	function setMovieComment($comment) {
		$this->movieComment = comment;
	}
	function setMovieType($type) {
		$this->movieType = type;
	}
	function setMovieWatched($watch) {
		$this->movieWatched = watch;
	}
	function setMovieScroe($scroe) {
		$this->movieScroe = scroe;
	}
	function setMoviePrice($price) {
		$this->moviePrice = price;
	}
	
	// getter
	function getMovieId() {
		return $this->movieId;
	}
	function getMovieImg() {
		return $this->movieImg;
	}
	function getMovieName() {
		return $this->movieName;
	}
	function getMovieComment() {
		return $this->movieComment;
	}
	function getMovieType() {
		return $this->movieType;
	}
	function getMovieWatched() {
		return $this->movieWatched;
		}
		function getMovieScroe() {
			return $this->movieScroe;
		}
		function getMoviePrice() {
			return $this->moviePrice;
		}

		
		function _queryNewestMovie() {
			$arr = array();
			// 连接mysql
			$con = linkMySql();
			// choose database
			// 每次取10条
			$sql = "select * from ".NEWEST_MOVIE." order by ".NEWEST_MOVIE_DATE." desc limit 10 ";
			$query = mysqli_query($con, $sql);
// 			$new_arr = mysqli_fetch_assoc($query);
			while($new_arr = mysqli_fetch_assoc($query)){
			    $arr[] = $new_arr; 
			}
			
			return $arr;
		}
	}
?>